
public class hanoi {

	public static void show(int[] arr){
		for (int i=0;i<arr.length;i++){
/*			switch (arr[i]){
			case 0:
				System.out.println(i+" * *");
				break;
			case 1:
				System.out.println("* "+i+" *");
				break;
			case 2:
				System.out.println("* * "+i);
				break;
			default:
				System.out.println("error!");
			}*/
			for (int j=0;j<3;j++) {
				System.out.print(arr[i]==j?i+1+" ":"* ");
			}
			System.out.println();
		}
		System.out.println();
	}
	public static void turn(int[] arr){
		solved(arr,arr.length,1);
	}
	public static boolean finish(int[] arr){
		boolean b=true;
		for (int i=0; i<arr.length; i++)
			b &= arr[i]==2;
		return b;	
	}
	public static void solved(int[] arr, int n,int target){
		int nonTarget;
		int mkor=arr[0];
		if (n==0)
			return;
		else {
			nonTarget=((3-mkor)-target);
			solved(arr,n-1,nonTarget);
			arr[n-1]=target;
			show(arr);
			solved(arr,n-1,target);
			return;
		}
	}
}
